package com.axjy.controller;

import com.axjy.pojo.Menu;
import com.axjy.pojo.User;
import com.axjy.service.PermissionService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

/**
 * Created by asus on 2017/9/20.
 */

@Controller
public class IndexHandler {

    @Resource
    private PermissionService permissionService;

    @RequestMapping("/index")
    public String index(HttpSession session,Model model){
        User loginUser= (User) session.getAttribute("loginUser");
        Map<Menu,List<Menu>> map=permissionService.searchNav(loginUser.getId());
        model.addAttribute("nav",map);

        return "index";
    }


}
